<template>
    <view>
        <block v-if="contentList.length">
            <view class="top">
                <view class="img item">图片</view>
                <view class="name item">名称</view>
                <view class="stock item">标准库存</view>
                <view class="num item">当前库存数量</view>
                <!-- <view class="classy">
					<view class="name">全部</view>
					<image src="/static/icons/right.png"></image>
				</view> -->
            </view>

            <!-- <view class="grey" v-if="classyShow"></view> -->

            <view class="goodsList">
                <view class="goods" v-for="(item, index) in contentList[classyIndex].list" :key="index">
                    <view class="icon">
                        <image :src="item.urlPhoto || '/static/icons/goods.png'"></image>
                    </view>
                    <view class="name">
                        <view class="name-item">{{ item.goodsName }}</view>
                    </view>
                    <view v-if="item.saleMode === 3" class="stockNum">{{ item.stockNum }}</view>
                    <view v-if="item.saleMode === 2" class="stockNum">{{ item.stockWeight }}</view>
                    <view class="count">
                        <view class="count-item">
                            <view class="numberButton" @click="countSub(index)">-</view>
                            <view class="number">
                                <input v-if="deviceType === 13 && item.saleMode === 3" type="number"
                                    v-model="item.newCount" @input="(val) => countCha(1, index, val)" />

                                <input v-if="deviceType === 13 && item.saleMode === 2" type="number"
                                    v-model="item.residueWeight" @input="(val) => countCha(2, index, val)" />
                                <input v-if="deviceType !== 13" type="number" v-model="item.residueNum" />
                            </view>
                            <view class="numberButton" @click="countAdd(index)">+</view>
                        </view>
                        <view v-if="deviceType === 13 && item.saleMode === 3">上货数量:{{ item.identifyResult }} 件</view>
                        <view v-if="deviceType === 13 && item.saleMode === 2">上货数量:{{ item.identifyResult }} 件</view>
                        <view v-if="deviceType !== 13">上货数量:{{ item.residueNum - item.count }} 件</view>
                    </view>
                </view>
            </view>

            <view class="bottom">
                <view class="button" @click="post">提交</view>
            </view>
        </block>

        <view class="empty" v-if="contentList.length == 0">
            <image src="/static/icons/empty.png" mode=""></image>
            空空如也
        </view>
    </view>
</template>

<script>
    import addStock from "./addStock.js";
    export default addStock;
</script>

<style>
    @import url("./addStock.css");
</style>